﻿using System.Windows.Forms;
using pub.CmdUI.Cmd;
using pub.CmdUI.UI.Control;

namespace todo.Cmd.View
{
    public class ZoomOutCmd : BaseZoomCmd
    {
        public ZoomOutCmd()
        {
            Shortcut = new CmdShortcut(Keys.Control | Keys.OemMinus);
        }

        public override void Execute(IControlUI controlUi)
        {
            var zoom = GetZoom();
            if (zoom <= 100)
            {
                zoom -= 5;
            }
            else if (zoom <= 200)
            {
                zoom -= 10;
            }
            else if (zoom <= 500)
            {
                zoom -= 15;
            }
            else
            {
                zoom -= 20;
            }
            if (zoom < 10)
            {
                zoom = 10;
            }
            SetZoom(zoom);
        }
    }
}